import React,{PureComponent} from 'react';
import {connect} from 'react-redux';
import {ListBox,ListA} from '../style';
import { Carousel } from 'antd';
import NewShow from './NewShow';
import TeacherShow from "./TeacherShow";
import StudentShow from "./StudentShow";
import BaseShow from "./BaseShow";
import SchoolShow from "./SchoolShow";

  class ListShow extends PureComponent {

      getYear(s){return s.toString().slice(0,4);}
      getDate(s){return s.toString().slice(5,6)==='0'?s.toString().slice(6):s.toString().slice(5);}
    render(){
          const data={
              // news:this.props.news.toJS(),
              students:this.props.students.toJS(),
              teachers:this.props.teachers.toJS(),
              bases:this.props.bases.toJS(),
              bar:this.props.bar.toJS(),
          };

        return(
            <ListBox>
                <NewShow/>
                {data.teachers.length>=2?<TeacherShow/>:null}
                {data.students.length>=2?<StudentShow/>:null}
                <ListA style={{height:'120px'}}>
                    <Carousel autoplay>
                        <div><div  className='publicity'><h1 style={{color:'#0d6fb8',fontSize:'40px'}}>师徒协同 &nbsp; 专创融合</h1></div></div>
                        <div><div  className='publicity'><h1 style={{color:'#0d6fb8',fontSize:'40px'}} >红色筑梦 &nbsp; 产教互动</h1></div></div>
                        <div><div  className='publicity'><h1 style={{color:'#0d6fb8',fontSize:'40px'}} >不忘初心 &nbsp; 砥砺前行</h1></div></div>
                    </Carousel>
                </ListA>
                {data.bases.menu!=null?data.bases.menu.length>=4?<BaseShow/>:null:null}
                {data.bar.length>=6?<SchoolShow/>:null}
            </ListBox>
        )

    }
}
const mapState=(state)=>({
    news: state.getIn(['home','news']),
    students:state.getIn(['home','students']),
    teachers:state.getIn(['home','teachers']),
    bases:state.getIn(['home','baseBar']),
    bar: state.getIn(['header','barMenu'])
});
export default connect(mapState,null)(ListShow);